package com.jinghua.treatment.controller;

import com.jinghua.treatment.entity.SysInquiry;
import com.jinghua.treatment.service.SysInquiryService;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * 问诊单控制器
 * Created by 王兴光 on 2018/3/24.
 */
@Controller
@RequestMapping("/inquiry")
public class SysInquiryController {

    /**
     * 问诊单service接口
     */
    @Resource
    private SysInquiryService inquiryService;

    @ApiOperation(value="添加问诊单信息")
    @GetMapping(value="/insertInquiry")
    @ResponseBody
    public int insertInquiry(SysInquiry inquiry){return inquiryService.insert(inquiry);}

    @ApiOperation(value="更新问诊单信息")
    @GetMapping(value="/updateInquiry")
    @ResponseBody
    public int updateInquiry(SysInquiry inquiry){return inquiryService.updateByPrimaryKey(inquiry);}

    @ApiOperation(value="根据编号查询问诊单")
    @GetMapping(value="/getInquiry",params = {"inquiryId"})
    @ResponseBody
    public SysInquiry findInquiry(int inquiryId){return inquiryService.selectByPrimaryKey(inquiryId);}

    @ApiOperation(value="根据医生编号，查询问诊单信息列表")
    @GetMapping(value="/getListByDoctorId",params = {"doctorId"})
    @ResponseBody
    public List<SysInquiry> findInquiryByDoctorId(Integer doctorId){return inquiryService.selectByDoctorId(doctorId);}
}
